UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bVmbP7U0SzkRkp6PbRr56MRD394885SKujYRHy3aRdQ=' 
WHERE 
  key_id = '5cdee2d57ba6aa71946d8d3204098fbba33cfbabb8fce18af84f732bb6ecc5ff' 
  AND (
    token = 'bVmbP7U0SzkRkp6PbRr56MRD394885SKujYRHy3aRdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020