UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y2WoWO+dL6d5yGenL+QGCepv7qB+RB6C54Ai6ys8tjM='
WHERE
key_id = 'd0032edb86ee0c5044aa3e0d84de58a94949f3884ca5824c12a56933620ea99e'
AND (
token = 'Y2WoWO+dL6d5yGenL+QGCepv7qB+RB6C54Ai6ys8tjM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)