UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vfB75xokckfgWu9h1x71ROkHzdnFwri416lTAWWimEs=' 
WHERE 
  key_id = 'cbd450cf74c2eb977b644a017dfb8c644c0f76c4a50a454e719739863b443225' 
  AND (
    token = 'vfB75xokckfgWu9h1x71ROkHzdnFwri416lTAWWimEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025