UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uGlLkdqDDn0ROryTvdb0sVApfeX79NokbnTmSzry3Q8='
WHERE
key_id = '7c93e68cafe2b49d88d8b1066b035fe007f6b4128dfdc1393a4d0488860bd114'
AND (
token = 'uGlLkdqDDn0ROryTvdb0sVApfeX79NokbnTmSzry3Q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)