UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2rhqmO7DPlWsdXoYaWvsvmH6Dnk3wCcMug7u5HUsfU8='
WHERE
key_id = '8fc034855c318145c40991f01c4a59dae95fd4a28c0c396c6dc64d03ba5edb4a'
AND (
token = '2rhqmO7DPlWsdXoYaWvsvmH6Dnk3wCcMug7u5HUsfU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)