UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tcrnEO/QZNJIt6YAwBShj6cg8pGl7iJhq4qPboy/42E='
WHERE
key_id = 'f4e001141ee62b5c9f5931b2af0e50704518d5094a3cbe167a965aec16680f4a'
AND (
token = 'tcrnEO/QZNJIt6YAwBShj6cg8pGl7iJhq4qPboy/42E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)