UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xFymf5ugI1niMgUavOjL5xNyfSxhFcKgG1A1LhqloEo='
WHERE
key_id = '5937b1003b69fb8bb194a553a716e99a8367fa53a0f17c0c02f612826ce7abee'
AND (
token = 'xFymf5ugI1niMgUavOjL5xNyfSxhFcKgG1A1LhqloEo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)