UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'niui0rEXyepIIG2HJXy9fp8P6WngDneJzfVJlkm9bxA=' 
WHERE 
  key_id = '0221588d013b1638b72343ad7a46222ba9477cb311b0bf8fbb67381d954f9f46' 
  AND (
    token = 'niui0rEXyepIIG2HJXy9fp8P6WngDneJzfVJlkm9bxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035