UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jEz5men0vnONF0GLPPPMeZy3881Ay2S/2y82q4uBScE=' 
WHERE 
  key_id = '6964c0bd2571528061def00ce49d99962887bb08b63b81e38586ad8e810713a2' 
  AND (
    token = 'jEz5men0vnONF0GLPPPMeZy3881Ay2S/2y82q4uBScE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022