UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vxWG4aAE7nhdX05a78TX6eqzMK3VnZD/0Y+5JORyDmU='
WHERE
key_id = '77a77bf90cb0839b1c1af2278c0ebaf78413da1062ed57f8c2ab88f890c120c0'
AND (
token = 'vxWG4aAE7nhdX05a78TX6eqzMK3VnZD/0Y+5JORyDmU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)