UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xE0tcyW5xFfswADuWNmFAr0d4IP6Jzkd6TWTbXvwzfE='
WHERE
key_id = 'e4d20c913afe39cd977698fb7456326ebe17da36292a488dd4d855df755b6321'
AND (
token = 'xE0tcyW5xFfswADuWNmFAr0d4IP6Jzkd6TWTbXvwzfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)