UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v/ZNcL+m6ijNdI6XStrECkTe1E9Pdyot7p8C2CeRL7s='
WHERE
key_id = 'c63a6475f4713b7d82450c4e3e4420e7f2832111df7b23a207ff6fc749826095'
AND (
token = 'v/ZNcL+m6ijNdI6XStrECkTe1E9Pdyot7p8C2CeRL7s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)