UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ipC0yKYM3YpUGPBppEw+fNLBDGxk5yKlHgkw28Jtf38='
WHERE
key_id = 'ace7fd5d4e120f6fd47668ad1e68ee4e8eebecc75657de99f63f63d6dfd02380'
AND (
token = 'ipC0yKYM3YpUGPBppEw+fNLBDGxk5yKlHgkw28Jtf38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)