UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oGp0lqhf3vp+uQa+X3ISMTJy1hnBHylsDxJrm2C3eb0=' 
WHERE 
  key_id = 'c83d01e4149ea6c830fdd9c990f4d4813d6f018e561efdb3eac945636013bb84' 
  AND (
    token = 'oGp0lqhf3vp+uQa+X3ISMTJy1hnBHylsDxJrm2C3eb0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037