UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HWpn1e3cGvyBAiPHFPvJd6CI71QEiIBcBaLqiEe91v4=' 
WHERE 
  key_id = '329a040c744aa393d33eef0ba484a1b8b36b65acf37207b1d213ec21fc4f3400' 
  AND (
    token = 'HWpn1e3cGvyBAiPHFPvJd6CI71QEiIBcBaLqiEe91v4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031