UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QDtaLOdD7rRCuXr1EYV5e0ufs17XF3VFlsBGzgoLxf0='
WHERE
key_id = 'e70c433d2e023e200274c968edd1ee5d7b95a68a416a58d976e8c8e3054697d0'
AND (
token = 'QDtaLOdD7rRCuXr1EYV5e0ufs17XF3VFlsBGzgoLxf0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)