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

Query time 0.00039