UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yhOOktQHah8mup+0bsPcuZdd8tLlGUpOo2Y8iqVeVM8=' 
WHERE 
  key_id = '97dce26c908fddda918070274c71179c9e2238922f2b0ed580bcf6eb693c1294' 
  AND (
    token = 'yhOOktQHah8mup+0bsPcuZdd8tLlGUpOo2Y8iqVeVM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017