UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7DFfIDkg1rwMlS1EAKcYybOUxKd6I9i8ApuI9/2lpQ4='
WHERE
key_id = 'c7a1c53c5ef7a876032687935ec40b4e521190c604406ed7608d9b0507cc609b'
AND (
token = '7DFfIDkg1rwMlS1EAKcYybOUxKd6I9i8ApuI9/2lpQ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)