UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OkrfBgJDbWw5/CLSAe2fZWKOZFaSLS8tYVmWqcGVuIs=' 
WHERE 
  key_id = '8bc193b297846ec4c0cd8859a7097104640d08cb43fd6dc232876de7241778e1' 
  AND (
    token = 'OkrfBgJDbWw5/CLSAe2fZWKOZFaSLS8tYVmWqcGVuIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032