UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OZlIUCMOrjk0TmFFQK8VOG3utS4ZkAj/xSWO102IFr4='
WHERE
key_id = '81dfde1bcab40d899073f8c5916cf6efff52ed5bdc5af2e1a23b4de0a8c9f91a'
AND (
token = 'OZlIUCMOrjk0TmFFQK8VOG3utS4ZkAj/xSWO102IFr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)