UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uYJVmkU1Oe3OO9o6Qez7tdzLiJERbGA4Zvwk5UHLPX4='
WHERE
key_id = '8f0737797ceddcabb56e4e92168a754afd1f028e2f2691d7ce4b53ac0325b1fe'
AND (
token = 'uYJVmkU1Oe3OO9o6Qez7tdzLiJERbGA4Zvwk5UHLPX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)