UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ujVWq88zRObDTF1t2FOCi98E+nNdoAq8EAmkp1seWqM=' 
WHERE 
  key_id = '03fff4d355e6ef73c8607fbd10976331f0135af4f17a973e5b9c4fe526f578d3' 
  AND (
    token = 'ujVWq88zRObDTF1t2FOCi98E+nNdoAq8EAmkp1seWqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039