UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bql9EyMIwKYL2auIH8XQXxz09Y2hM3O7zPaz+8yOpK0='
WHERE
key_id = 'b2e196af7240bff2c3127579bd351320f025479d7e0315219ed56843f75ee8bc'
AND (
token = 'bql9EyMIwKYL2auIH8XQXxz09Y2hM3O7zPaz+8yOpK0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)