UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CR+zgVBCAxphu2l0JFG3f1bB/VnKoGME3hKfifYUm1M=' 
WHERE 
  key_id = '4eeb8e60e2808f09670c8998d685b21b9baf63db7112c97bb3437f79c472dfa9' 
  AND (
    token = 'CR+zgVBCAxphu2l0JFG3f1bB/VnKoGME3hKfifYUm1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036