UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qS7L/X3HgkSqA13/U5FlZG5RW0qT+QnTPXNX5lPtKD8='
WHERE
key_id = '3e8819bdcf6c48742412eb5d226af31015d02b38c5efe7517c54f15641017a9a'
AND (
token = 'qS7L/X3HgkSqA13/U5FlZG5RW0qT+QnTPXNX5lPtKD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)