UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GfzSkQvlFkC35gGE7VMwSQjx+L9cc3mS3gGxXRseIa4='
WHERE
key_id = '3b16b4756bc03465683af01a3a68e507632c2c7a5ecfc47213b7528eb40a8bba'
AND (
token = 'GfzSkQvlFkC35gGE7VMwSQjx+L9cc3mS3gGxXRseIa4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)