UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gvvsx7J2Lv6GAy/iZdQt+VCa4p0yQsLCQv0l28VoF1M=' 
WHERE 
  key_id = '25417f8340eaa475a152907981a7833569aa193a8e99850fc6745d9365179d6a' 
  AND (
    token = 'gvvsx7J2Lv6GAy/iZdQt+VCa4p0yQsLCQv0l28VoF1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038