UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O+6ekZxn+0hxgm6GHWu0zweRlSDwUMxMQcoKjfQC5rU='
WHERE
key_id = '5be5980c5e9f59709fb748aa614d7eb835e0d1e7a6460e65d47bd575ddb6cc70'
AND (
token = 'O+6ekZxn+0hxgm6GHWu0zweRlSDwUMxMQcoKjfQC5rU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)