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