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