UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0wPYWCU2gNDKWqkb7/4mvtx2GmFNpJW5bxnp4QvaBv4='
WHERE
key_id = 'b61b90386705f9835ea2cca386532a4798ba565279eef17e3fc34c022bff480d'
AND (
token = '0wPYWCU2gNDKWqkb7/4mvtx2GmFNpJW5bxnp4QvaBv4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)