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