UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I1atYHKYqbeg81OT0nzBU1jgguvyRuYCseZRXPxDsCc=' 
WHERE 
  key_id = '89523dd358dbfac0c1c42eb5a86d794e9f2942771e505722daa151815f14b810' 
  AND (
    token = 'I1atYHKYqbeg81OT0nzBU1jgguvyRuYCseZRXPxDsCc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034