UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '86CG9m7uYa3CHZoEWuzYXTdIQGPgboUvCjs4d3usWtA=' 
WHERE 
  key_id = '47974ce53257070eaab62e7016006c795b5c20d6f153698e33ab92627462a17d' 
  AND (
    token = '86CG9m7uYa3CHZoEWuzYXTdIQGPgboUvCjs4d3usWtA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027