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