UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd7zArmizvcPiDlr/g+DOsCcKJg6rRmsi3rA5eD0EWc8='
WHERE
key_id = '317d03d013030d0a3ae235a8c042bb0bc497ed20fc43cc0a35404c90eaa079bf'
AND (
token = 'd7zArmizvcPiDlr/g+DOsCcKJg6rRmsi3rA5eD0EWc8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)