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