UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7RKMIcdWl4hWtI5eoPtbSObTgpRApbD9mjd876ZeGn8='
WHERE
key_id = '12ab731f4bd48f150dd535f30270648de22da7474f2c8d95aebb84f226bdb750'
AND (
token = '7RKMIcdWl4hWtI5eoPtbSObTgpRApbD9mjd876ZeGn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)