UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XrfbrW1dpBZ2jTls0Y1fUmrMR3DaHZAtCcLpQpFQ7n0='
WHERE
key_id = '7f01b80b7346790b5e8ea2d73e08a4ec99188d6237bc3fa4c7344f872e4786f3'
AND (
token = 'XrfbrW1dpBZ2jTls0Y1fUmrMR3DaHZAtCcLpQpFQ7n0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)